#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QThread>
#include <QTime>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class TimeThread:public QThread
{
    Q_OBJECT

public:
    TimeThread(QObject *parent = nullptr){}

    void run() override
    {
        QString time;
        while (1) {

            QThread::sleep(1);

           // emit sendMsg();
             time = QTime::currentTime().toString("hh:mm:ss");
            emit sendData(time);
        }
    }
signals:

    //定义信号
    void sendMsg();

    void sendData(QString time);
};

class MainWindow : public QMainWindow
{
    Q_OBJECT



public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();



private slots:
    void on_pushButton_clicked();

    void on_checkBox_stateChanged(int arg1);

    void updateTime();

    void updateTime(QString time);

private:
    Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
